Những câu hỏi liên quan
Nguyễn Thanh Anh
Xem chi tiết
Nguyễn Thanh Anh
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 12 2022 lúc 14:33

uses crt;

var n,x,i,lt,gt:int64;

begin

clrscr;

readln(n);

gt:=1;

for i:=1 to n do gt:=gt*i;

writeln(gt);

readln(x);

lt:=1;

for i:=1 to x do 

lt:=lt*n;

writeln(lt);

readln;

end.

Bình luận (0)
Quân Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 12 2020 lúc 20:57

Câu 1: 

uses crt;

var a:array[1..500]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

       write('A[',i,']='); readln(a[i]);

  end;

t:=0;

for i:=1 to n do 

  if (a[i]<0) and (a[i] mod 7=0) then t:=t+a[i];

writeln('Tong cac so am chia het cho 7 la: ',t);

readln;

end.

Câu 2: 

uses crt;

var c,a:array[1..10]of integer;

i,kt,j,dem:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

write('C[',i,']='); readln(c[i]);

end;

dem:=0;

for i:=1 to 10 do 

  if c[i]>1 then 

begin

kt:=0;

for j:=2 to c[i]-1 do 

  if c[i] mod j=0 then kt:=1;

if kt=0 then 

begin

inc(dem);

a[dem]:=c[i];

end;

end;

if dem=0 then writeln('Trong day khong co so nguyen to')

else begin

writeln('Cac so nguyen to trong day la: ');

for i:=1 to dem do

write(a[i]:4);

end;

readln;

end.

Câu 3: 

uses crt;

var d:array[1..200]of integer;

i,k,dem:integer;

begin

clrscr;

write('Nhap k='); readln(k);

for i:=1 to k do 

  begin

write('D[',i,']='); readln(d[i]);

end;

dem:=0;

for i:=1 to k do 

  if (a[i] mod 2=0) and (a[i]>=10) then inc(dem);

writeln('So phan tu chan co 2 chu so la: ',dem);

readln;

end.

Bình luận (0)
NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 2 2023 lúc 0:38

Câu 6:

uses crt;

var n,i:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

if n mod i=0 then write(i:4);

readln;

end.

5:

uses crt;

var n,i,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=0 to n do

if i mod 2=1 then 

begin

write(i:4);

dem:=dem+1;

end;

writeln;

writeln(dem);

readln;

end.

Bình luận (0)
Nguyenthanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 5 2021 lúc 20:44

Câu 1: 

uses crt;

var n,i:integer;

s:real;

begin

clrscr;

write('Nhap n='); readln(n);

s:=1;

for i:=1 to n do

s:=s*i;

writeln(s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
9 tháng 5 2021 lúc 20:44

Câu 2: 

uses crt;

var t,i,n:integer;

begin

clrscr;

write('Nhap n='); readln(n);

t:=0;

for i:=1 to n do

t:=t+i;

writeln(t);

readln;

end.

Bình luận (0)
Truy Kích 3.0
29 tháng 5 2021 lúc 9:51

Bài 2 dùng công thức n*(n+1)/2

Bình luận (0)
San San
Xem chi tiết
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:21

Câu 1: 
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 <> 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:22

Câu 2:
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 = 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)
Lâm Khả Doanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:28

1:

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

t:=t+i*i;

write(t);

readln;

end.

Bình luận (0)
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:21

2

program bt2;

var i,n,t:integer;

begin

readln(n);

s:=0;

for i:=1 to n do

if i mod 2 = 1 then s:=s+i;

readln;

end.

Bình luận (0)
Dang2009 Trần
Xem chi tiết
Như Ý
Xem chi tiết
Phía sau một cô gái
1 tháng 5 2023 lúc 19:27

Câu 1:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);

     readln; 

end.

Câu 2:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 1 to n do

     begin

          if i mod 2 = 1 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);

     readln;

end.

Bình luận (1)